class UserAccount extends Avalon.VM {
    $id = 'UserAccount';
    Where = {};
    $WHere = {};
    DICs = {};
    loginInput={
        Account:'',
        PWD:'',
        Code:''
    };
    init_DICs() {
        //TODO 编写初始化工作
    }

    _before_do_add = function (req) {
        //TODO 添加前的过滤，返回false表示不再继续请求
    };
    _after_do_add = function (data) {
        //添加后的判断
    };
    _after_do_save = function (data) {
        //保存后的判断，
        if (data === true || data instanceof Object) {
            //success 逻辑
        } else {
            //error 逻辑
        }
    };
    _before_do_search = function (req) {
        //TODO 此处编写发起搜索请求前的过滤逻辑，如将范围选择转化成['IN',[1,2]]结构
        // req.W.X=['IN',req.w.X]
        // delete req.W.P
    };
    _object_format = function (obj) {
        //TODO 此处编写该对象的格式化函数，如将obj.Time转成Date类型
    };
    loginFn=function () {
        Castle.Request.post(Config.getRequestUrl('UserAccount','login'),{
            Account:this.loginInput.Account,
            PWD:this.loginInput.PWD
        },function (data) {
            if(data instanceof Object){
                window.location.href='admin.html';
            }else{
                tip('错误');
            }
        },function (err) {
            tip(err)
        })
    }

}

let UserAccountVM = avalon.define(new UserAccount());